<?php
namespace Admin\Controller;
use Think\Controller;
use Admin\Common\Api\UserApi;
class IndexController extends BaseController {
    private $adminUser = null;
    public function _initialize(){
    	parent::_initialize();
    	$this->adminUser = new UserApi();

    }
	//获取后台管理员的信息
    public function index(){
      
      $this->display();
    }

   public function admin_list(){
          $title =I('request.title','','trim');
        if(!empty($title)){
           $where['username'] =array('like',"%{$title}%");
           // print_r($_where);exit;
           // $_where['parcelname']=array('like',"%{$keywords}%");
        }
         // $where['is_activity'] = 1;
        $_where_order_field["listrows"] =I("request._listrows");
        $_where_order_field["where"] = $where;
        $_where_order_field["field"] = '*';
        $_where_order_field["order"] = 'id desc';
        $_datalist= $this->_getListsFromModel('user',$_where_order_field);
        // print_r($_datalist['page_html']);exit;
        $this->assign('lists',$_datalist);
        $this->display();
   }

   public function del_admin(){
          if(IS_POST){
        $allid = I('post.allid');
        $where = "id in (".$allid.")";
          $row = D('user')->where($where)->delete();
             if($row != flase){
                  $ret=array('state'=>'1','msg'=>"批量删除成功!");
            }else{
               $ret=array('staute'=>'0','msg'=>"批量删除失败！");
           }
        }else{
            $ret=array('staute'=>'0','msg'=>"批量删除失败,信息传递错误！");
        }

        //echo D('group_purchase')->getLastSql();

     $this->ajaxReturn($ret);



   }
}
